package demo1;
public class Animal {
    public String name;
    public int age;
    static {
        System.out.println("执行了静态代码块");
    }
    {
        System.out.println("执行了实例代码块");
    }
    public void eat(){
//        System.out.println(this.name+"正在吃饭");
        System.out.println("执行了构造方法");

    }

    public Animal(String name, int age) {
        this.name = name;
        this.age = age;
//        System.out.println("执行了构造方法");
    }
}
